<template>
	<view class="">
		<scroll-view :scroll-into-view="topItem" scroll-y scroll-top="0" class=" setScrollHeight" :style="heightSure"
			@scroll="handleScroll" @scrolltolower="refresherList()">
			<view id="topPosition" class="setFontColor1">
				<!-- 共为您找到{{allSize}}条结果 -->
				<slot name="t1">

				</slot>
			</view>

			<slot name="t2">

			</slot>

		</scroll-view>
		<view class="setBackup" v-if="isShow" @click="handleBackTop" :style="colorSure">
			<!-- <image src="../../static/images/scroll-top.png" mode="" style="width: 100%;height: 100%;"></image> -->
			
			<text class="iconfont icondirection-up" style="font-size: 60rpx;"></text>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			heightSure: {
				type: String,
				String:''
			},
			colorSure: {
				type: String,
				String:''
			}
		},
		data() {
			return {
				// 返回的按钮是否显示
				isShow: false,
				// 返回顶部的标记点
				topItem: ''
			}
		},
		methods:{
			// 回到顶部
			handleScroll(e) {
				// 只有scrollTop有用，先拿scrollTop
				let scrollTop = e.detail.scrollTop
				// 滑动大于500让按钮显示
				this.isShow = scrollTop > 300
				// 因为点第二次不行，这里记得重置清空一下
				this.topItem = ''
				
			},
			handleBackTop() {
				this.topItem = 'topPosition'
			},
			refresherList(){
			
				this.$emit('refreshArr')
			}
			
		}
	}
</script>

<style>
	
</style>
